package com.itzol.javablog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itzol.javablog.entity.Postvo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface Postvomapper extends BaseMapper<Postvo> {
    //查询Post category 两张表的数据 多表查询 且分页 并且 返回总记录数
    @Select("select (select count(*) from post) num, p.id id,p.title,p.summary,c.name categoryname from post p,category c where p.categoryid=c.id order by p.id DESC limit #{page},#{size}")
    List<Postvo> postvo(Integer page,Integer size);
}
